Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
| 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.2.5" /> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | <style type="text/css"> |
| 8 | /* Debug borders */ |
| 9 | p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { |
| 10 | /* |
| 11 | border: 1px solid red; |
| 12 | */ |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | margin: 1em 5% 1em 5%; |
| 17 | } |
| 18 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 19 | a { |
| 20 | color: blue; |
| 21 | text-decoration: underline; |
| 22 | } |
| 23 | a:visited { |
| 24 | color: fuchsia; |
| 25 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 26 | |
| 27 | em { |
| 28 | font-style: italic; |
| 29 | } |
| 30 | |
| 31 | strong { |
| 32 | font-weight: bold; |
| 33 | } |
| 34 | |
| 35 | tt { |
| 36 | color: navy; |
| 37 | } |
| 38 | |
| 39 | h1, h2, h3, h4, h5, h6 { |
| 40 | color: #527bbd; |
| 41 | font-family: sans-serif; |
| 42 | margin-top: 1.2em; |
| 43 | margin-bottom: 0.5em; |
| 44 | line-height: 1.3; |
| 45 | } |
| 46 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 47 | h1, h2, h3 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 48 | border-bottom: 2px solid silver; |
| 49 | } |
| 50 | h2 { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 51 | padding-top: 0.5em; |
| 52 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 53 | h3 { |
| 54 | float: left; |
| 55 | } |
| 56 | h3 + * { |
| 57 | clear: left; |
| 58 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 59 | |
| 60 | div.sectionbody { |
| 61 | font-family: serif; |
| 62 | margin-left: 0; |
| 63 | } |
| 64 | |
| 65 | hr { |
| 66 | border: 1px solid silver; |
| 67 | } |
| 68 | |
| 69 | p { |
| 70 | margin-top: 0.5em; |
| 71 | margin-bottom: 0.5em; |
| 72 | } |
| 73 | |
| 74 | pre { |
| 75 | padding: 0; |
| 76 | margin: 0; |
| 77 | } |
| 78 | |
| 79 | span#author { |
| 80 | color: #527bbd; |
| 81 | font-family: sans-serif; |
| 82 | font-weight: bold; |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 83 | font-size: 1.1em; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 84 | } |
| 85 | span#email { |
| 86 | } |
| 87 | span#revision { |
| 88 | font-family: sans-serif; |
| 89 | } |
| 90 | |
| 91 | div#footer { |
| 92 | font-family: sans-serif; |
| 93 | font-size: small; |
| 94 | border-top: 2px solid silver; |
| 95 | padding-top: 0.5em; |
| 96 | margin-top: 4.0em; |
| 97 | } |
| 98 | div#footer-text { |
| 99 | float: left; |
| 100 | padding-bottom: 0.5em; |
| 101 | } |
| 102 | div#footer-badges { |
| 103 | float: right; |
| 104 | padding-bottom: 0.5em; |
| 105 | } |
| 106 | |
| 107 | div#preamble, |
| 108 | div.tableblock, div.imageblock, div.exampleblock, div.verseblock, |
| 109 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, |
| 110 | div.admonitionblock { |
| 111 | margin-right: 10%; |
| 112 | margin-top: 1.5em; |
| 113 | margin-bottom: 1.5em; |
| 114 | } |
| 115 | div.admonitionblock { |
| 116 | margin-top: 2.5em; |
| 117 | margin-bottom: 2.5em; |
| 118 | } |
| 119 | |
| 120 | div.content { /* Block element content. */ |
| 121 | padding: 0; |
| 122 | } |
| 123 | |
| 124 | /* Block element titles. */ |
| 125 | div.title, caption.title { |
| 126 | font-family: sans-serif; |
| 127 | font-weight: bold; |
| 128 | text-align: left; |
| 129 | margin-top: 1.0em; |
| 130 | margin-bottom: 0.5em; |
| 131 | } |
| 132 | div.title + * { |
| 133 | margin-top: 0; |
| 134 | } |
| 135 | |
| 136 | td div.title:first-child { |
| 137 | margin-top: 0.0em; |
| 138 | } |
| 139 | div.content div.title:first-child { |
| 140 | margin-top: 0.0em; |
| 141 | } |
| 142 | div.content + div.title { |
| 143 | margin-top: 0.0em; |
| 144 | } |
| 145 | |
| 146 | div.sidebarblock > div.content { |
| 147 | background: #ffffee; |
| 148 | border: 1px solid silver; |
| 149 | padding: 0.5em; |
| 150 | } |
| 151 | |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 152 | div.listingblock { |
| 153 | margin-right: 0%; |
| 154 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 155 | div.listingblock > div.content { |
| 156 | border: 1px solid silver; |
| 157 | background: #f4f4f4; |
| 158 | padding: 0.5em; |
| 159 | } |
| 160 | |
| 161 | div.quoteblock > div.content { |
| 162 | padding-left: 2.0em; |
| 163 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 164 | |
| 165 | div.attribution { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 166 | text-align: right; |
| 167 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 168 | div.verseblock + div.attribution { |
| 169 | text-align: left; |
| 170 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 171 | |
| 172 | div.admonitionblock .icon { |
| 173 | vertical-align: top; |
| 174 | font-size: 1.1em; |
| 175 | font-weight: bold; |
| 176 | text-decoration: underline; |
| 177 | color: #527bbd; |
| 178 | padding-right: 0.5em; |
| 179 | } |
| 180 | div.admonitionblock td.content { |
| 181 | padding-left: 0.5em; |
| 182 | border-left: 2px solid silver; |
| 183 | } |
| 184 | |
| 185 | div.exampleblock > div.content { |
| 186 | border-left: 2px solid silver; |
| 187 | padding: 0.5em; |
| 188 | } |
| 189 | |
| 190 | div.verseblock div.content { |
| 191 | white-space: pre; |
| 192 | } |
| 193 | |
| 194 | div.imageblock div.content { padding-left: 0; } |
| 195 | div.imageblock img { border: 1px solid silver; } |
| 196 | span.image img { border-style: none; } |
| 197 | |
| 198 | dl { |
| 199 | margin-top: 0.8em; |
| 200 | margin-bottom: 0.8em; |
| 201 | } |
| 202 | dt { |
| 203 | margin-top: 0.5em; |
| 204 | margin-bottom: 0; |
| 205 | font-style: italic; |
| 206 | } |
| 207 | dd > *:first-child { |
| 208 | margin-top: 0; |
| 209 | } |
| 210 | |
| 211 | ul, ol { |
| 212 | list-style-position: outside; |
| 213 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 214 | div.olist2 ol { |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 215 | list-style-type: lower-alpha; |
| 216 | } |
| 217 | |
| 218 | div.tableblock > table { |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 219 | border: 3px solid #527bbd; |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 220 | } |
| 221 | thead { |
| 222 | font-family: sans-serif; |
| 223 | font-weight: bold; |
| 224 | } |
| 225 | tfoot { |
| 226 | font-weight: bold; |
| 227 | } |
| 228 | |
| 229 | div.hlist { |
| 230 | margin-top: 0.8em; |
| 231 | margin-bottom: 0.8em; |
| 232 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 233 | div.hlist td { |
| 234 | padding-bottom: 5px; |
| 235 | } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 236 | td.hlist1 { |
| 237 | vertical-align: top; |
| 238 | font-style: italic; |
| 239 | padding-right: 0.8em; |
| 240 | } |
| 241 | td.hlist2 { |
| 242 | vertical-align: top; |
| 243 | } |
| 244 | |
| 245 | @media print { |
| 246 | div#footer-badges { display: none; } |
| 247 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 248 | |
| 249 | div#toctitle { |
| 250 | color: #527bbd; |
| 251 | font-family: sans-serif; |
| 252 | font-size: 1.1em; |
| 253 | font-weight: bold; |
| 254 | margin-top: 1.0em; |
| 255 | margin-bottom: 0.1em; |
| 256 | } |
| 257 | |
| 258 | div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { |
| 259 | margin-top: 0; |
| 260 | margin-bottom: 0; |
| 261 | } |
| 262 | div.toclevel2 { |
| 263 | margin-left: 2em; |
| 264 | font-size: 0.9em; |
| 265 | } |
| 266 | div.toclevel3 { |
| 267 | margin-left: 4em; |
| 268 | font-size: 0.9em; |
| 269 | } |
| 270 | div.toclevel4 { |
| 271 | margin-left: 6em; |
| 272 | font-size: 0.9em; |
| 273 | } |
| 274 | include1::./stylesheets/xhtml11-manpage.css[] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 275 | /* Workarounds for IE6's broken and incomplete CSS2. */ |
| 276 | |
| 277 | div.sidebar-content { |
| 278 | background: #ffffee; |
| 279 | border: 1px solid silver; |
| 280 | padding: 0.5em; |
| 281 | } |
| 282 | div.sidebar-title, div.image-title { |
| 283 | font-family: sans-serif; |
| 284 | font-weight: bold; |
| 285 | margin-top: 0.0em; |
| 286 | margin-bottom: 0.5em; |
| 287 | } |
| 288 | |
| 289 | div.listingblock div.content { |
| 290 | border: 1px solid silver; |
| 291 | background: #f4f4f4; |
| 292 | padding: 0.5em; |
| 293 | } |
| 294 | |
| 295 | div.quoteblock-content { |
| 296 | padding-left: 2.0em; |
| 297 | } |
| 298 | |
| 299 | div.exampleblock-content { |
| 300 | border-left: 2px solid silver; |
| 301 | padding-left: 0.5em; |
| 302 | } |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 303 | |
| 304 | /* IE6 sets dynamically generated links as visited. */ |
| 305 | div#toc a:visited { color: blue; } |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 306 | </style> |
| 307 | <title>git-commit(1)</title> |
| 308 | </head> |
| 309 | <body> |
| 310 | <div id="header"> |
| 311 | <h1> |
| 312 | git-commit(1) Manual Page |
| 313 | </h1> |
| 314 | <h2>NAME</h2> |
| 315 | <div class="sectionbody"> |
| 316 | <p>git-commit - |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 317 | Record changes to the repository |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 318 | </p> |
| 319 | </div> |
| 320 | </div> |
| 321 | <h2>SYNOPSIS</h2> |
| 322 | <div class="sectionbody"> |
Junio C Hamano | 235a91e | 2006-01-07 01:13:58 | [diff] [blame] | 323 | <div class="verseblock"> |
Junio C Hamano | 1bb3199 | 2009-08-29 04:24:08 | [diff] [blame] | 324 | <div class="content"><em>git commit</em> [-a | --interactive] [-s] [-v] [-u<mode>] [--amend] [--dry-run] |
Junio C Hamano | 2bd8a74 | 2009-12-01 21:16:59 | [diff] [blame] | 325 | [(-c | -C) <commit>] [-F <file> | -m <msg>] [--reset-author] |
Junio C Hamano | cb39aea | 2010-05-09 07:24:48 | [diff] [blame] | 326 | [--allow-empty] [--allow-empty-message] [--no-verify] [-e] [--author=<author>] |
Junio C Hamano | 6ce6b6c | 2010-01-18 01:25:50 | [diff] [blame] | 327 | [--date=<date>] [--cleanup=<mode>] [--status | --no-status] [--] |
| 328 | [[-i | -o ]<file>…]</div></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 329 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 330 | <h2 id="_description">DESCRIPTION</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 331 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 332 | <div class="para"><p>Stores the current contents of the index in a new commit along |
| 333 | with a log message from the user describing the changes.</p></div> |
| 334 | <div class="para"><p>The content to be added can be specified in several ways:</p></div> |
| 335 | <div class="olist"><ol> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 336 | <li> |
| 337 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 338 | by using <em>git add</em> to incrementally "add" changes to the |
Junio C Hamano | b515b6a | 2007-08-08 09:21:16 | [diff] [blame] | 339 | index before using the <em>commit</em> command (Note: even modified |
| 340 | files must be "added"); |
| 341 | </p> |
| 342 | </li> |
| 343 | <li> |
| 344 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 345 | by using <em>git rm</em> to remove files from the working tree |
Junio C Hamano | bd2b4bb | 2007-08-06 06:42:24 | [diff] [blame] | 346 | and the index, again before using the <em>commit</em> command; |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 347 | </p> |
| 348 | </li> |
| 349 | <li> |
| 350 | <p> |
Junio C Hamano | bd2b4bb | 2007-08-06 06:42:24 | [diff] [blame] | 351 | by listing files as arguments to the <em>commit</em> command, in which |
| 352 | case the commit will ignore changes staged in the index, and instead |
Junio C Hamano | 5081985 | 2008-11-19 02:07:56 | [diff] [blame] | 353 | record the current content of the listed files (which must already |
| 354 | be known to git); |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 355 | </p> |
| 356 | </li> |
| 357 | <li> |
| 358 | <p> |
Junio C Hamano | bd2b4bb | 2007-08-06 06:42:24 | [diff] [blame] | 359 | by using the -a switch with the <em>commit</em> command to automatically |
| 360 | "add" changes from all known files (i.e. all files that are already |
| 361 | listed in the index) and to automatically "rm" files in the index |
| 362 | that have been removed from the working tree, and then perform the |
| 363 | actual commit; |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 364 | </p> |
| 365 | </li> |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 366 | <li> |
| 367 | <p> |
| 368 | by using the --interactive switch with the <em>commit</em> command to decide one |
| 369 | by one which files should be part of the commit, before finalizing the |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 370 | operation. Currently, this is done by invoking <em>git add --interactive</em>. |
Junio C Hamano | c51fede | 2007-03-12 07:29:20 | [diff] [blame] | 371 | </p> |
| 372 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 373 | </ol></div> |
Junio C Hamano | 1bb3199 | 2009-08-29 04:24:08 | [diff] [blame] | 374 | <div class="para"><p>The <tt>--dry-run</tt> option can be used to obtain a |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 375 | summary of what is included by any of the above for the next |
Junio C Hamano | 1bb3199 | 2009-08-29 04:24:08 | [diff] [blame] | 376 | commit by giving the same set of parameters (options and paths).</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 377 | <div class="para"><p>If you make a commit and then find a mistake immediately after |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 378 | that, you can recover from it with <em>git reset</em>.</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 379 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 380 | <h2 id="_options">OPTIONS</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 381 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 382 | <div class="vlist"><dl> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 383 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 384 | -a |
| 385 | </dt> |
| 386 | <dt> |
| 387 | --all |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 388 | </dt> |
| 389 | <dd> |
| 390 | <p> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 391 | Tell the command to automatically stage files that have |
| 392 | been modified and deleted, but new files you have not |
| 393 | told git about are not affected. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 394 | </p> |
| 395 | </dd> |
| 396 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 397 | -C <commit> |
| 398 | </dt> |
| 399 | <dt> |
| 400 | --reuse-message=<commit> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 401 | </dt> |
| 402 | <dd> |
| 403 | <p> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 404 | Take an existing commit object, and reuse the log message |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 405 | and the authorship information (including the timestamp) |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 406 | when creating the commit. |
| 407 | </p> |
| 408 | </dd> |
| 409 | <dt> |
| 410 | -c <commit> |
| 411 | </dt> |
| 412 | <dt> |
| 413 | --reedit-message=<commit> |
| 414 | </dt> |
| 415 | <dd> |
| 416 | <p> |
| 417 | Like <em>-C</em>, but with <em>-c</em> the editor is invoked, so that |
| 418 | the user can further edit the commit message. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 419 | </p> |
| 420 | </dd> |
| 421 | <dt> |
Junio C Hamano | 2bd8a74 | 2009-12-01 21:16:59 | [diff] [blame] | 422 | --reset-author |
| 423 | </dt> |
| 424 | <dd> |
| 425 | <p> |
| 426 | When used with -C/-c/--amend options, declare that the |
| 427 | authorship of the resulting commit now belongs of the committer. |
| 428 | This also renews the author timestamp. |
| 429 | </p> |
| 430 | </dd> |
| 431 | <dt> |
Junio C Hamano | a0fae26 | 2009-12-28 09:33:50 | [diff] [blame] | 432 | --short |
| 433 | </dt> |
| 434 | <dd> |
| 435 | <p> |
| 436 | When doing a dry-run, give the output in the short-format. See |
| 437 | <a href="git-status.html">git-status(1)</a> for details. Implies <tt>--dry-run</tt>. |
| 438 | </p> |
| 439 | </dd> |
| 440 | <dt> |
| 441 | --porcelain |
| 442 | </dt> |
| 443 | <dd> |
| 444 | <p> |
| 445 | When doing a dry-run, give the output in a porcelain-ready |
| 446 | format. See <a href="git-status.html">git-status(1)</a> for details. Implies |
| 447 | <tt>--dry-run</tt>. |
| 448 | </p> |
| 449 | </dd> |
| 450 | <dt> |
| 451 | -z |
| 452 | </dt> |
| 453 | <dd> |
| 454 | <p> |
| 455 | When showing <tt>short</tt> or <tt>porcelain</tt> status output, terminate |
| 456 | entries in the status output with NUL, instead of LF. If no |
| 457 | format is given, implies the <tt>--porcelain</tt> output format. |
| 458 | </p> |
| 459 | </dd> |
| 460 | <dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 461 | -F <file> |
| 462 | </dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 463 | <dt> |
| 464 | --file=<file> |
| 465 | </dt> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 466 | <dd> |
| 467 | <p> |
| 468 | Take the commit message from the given file. Use <em>-</em> to |
| 469 | read the message from the standard input. |
| 470 | </p> |
| 471 | </dd> |
| 472 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 473 | --author=<author> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 474 | </dt> |
| 475 | <dd> |
| 476 | <p> |
Junio C Hamano | 13002fb | 2010-06-08 05:53:58 | [diff] [blame] | 477 | Override the commit author. Specify an explicit author using the |
| 478 | standard <tt>A U Thor <author@example.com></tt> format. Otherwise <author> |
| 479 | is assumed to be a pattern and is used to search for an existing |
| 480 | commit by that author (i.e. rev-list --all -i --author=<author>); |
| 481 | the commit author is then copied from the first such commit found. |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 482 | </p> |
| 483 | </dd> |
| 484 | <dt> |
Junio C Hamano | ae05fee | 2010-01-08 07:39:46 | [diff] [blame] | 485 | --date=<date> |
| 486 | </dt> |
| 487 | <dd> |
| 488 | <p> |
| 489 | Override the author date used in the commit. |
| 490 | </p> |
| 491 | </dd> |
| 492 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 493 | -m <msg> |
| 494 | </dt> |
| 495 | <dt> |
| 496 | --message=<msg> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 497 | </dt> |
| 498 | <dd> |
| 499 | <p> |
| 500 | Use the given <msg> as the commit message. |
| 501 | </p> |
| 502 | </dd> |
| 503 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 504 | -t <file> |
| 505 | </dt> |
| 506 | <dt> |
| 507 | --template=<file> |
Junio C Hamano | a3770f9 | 2007-07-25 08:53:33 | [diff] [blame] | 508 | </dt> |
| 509 | <dd> |
| 510 | <p> |
| 511 | Use the contents of the given file as the initial version |
| 512 | of the commit message. The editor is invoked and you can |
| 513 | make subsequent changes. If a message is specified using |
Junio C Hamano | b968dbb | 2007-07-27 07:26:40 | [diff] [blame] | 514 | the <tt>-m</tt> or <tt>-F</tt> options, this option has no effect. This |
| 515 | overrides the <tt>commit.template</tt> configuration variable. |
Junio C Hamano | a3770f9 | 2007-07-25 08:53:33 | [diff] [blame] | 516 | </p> |
| 517 | </dd> |
| 518 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 519 | -s |
| 520 | </dt> |
| 521 | <dt> |
| 522 | --signoff |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 523 | </dt> |
| 524 | <dd> |
| 525 | <p> |
Junio C Hamano | 610d176 | 2008-11-28 06:27:13 | [diff] [blame] | 526 | Add Signed-off-by line by the committer at the end of the commit |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 527 | log message. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 528 | </p> |
| 529 | </dd> |
| 530 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 531 | -n |
| 532 | </dt> |
| 533 | <dt> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 534 | --no-verify |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 535 | </dt> |
| 536 | <dd> |
| 537 | <p> |
Junio C Hamano | 942b35e | 2007-12-09 10:19:33 | [diff] [blame] | 538 | This option bypasses the pre-commit and commit-msg hooks. |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 539 | See also <a href="githooks.html">githooks(5)</a>. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 540 | </p> |
| 541 | </dd> |
| 542 | <dt> |
Junio C Hamano | 0c99970 | 2007-12-03 09:57:55 | [diff] [blame] | 543 | --allow-empty |
| 544 | </dt> |
| 545 | <dd> |
| 546 | <p> |
| 547 | Usually recording a commit that has the exact same tree as its |
Junio C Hamano | 5825687 | 2007-12-04 08:31:13 | [diff] [blame] | 548 | sole parent commit is a mistake, and the command prevents you |
| 549 | from making such a commit. This option bypasses the safety, and |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 550 | is primarily for use by foreign SCM interface scripts. |
Junio C Hamano | 0c99970 | 2007-12-03 09:57:55 | [diff] [blame] | 551 | </p> |
| 552 | </dd> |
| 553 | <dt> |
Junio C Hamano | cb39aea | 2010-05-09 07:24:48 | [diff] [blame] | 554 | --allow-empty-message |
| 555 | </dt> |
| 556 | <dd> |
| 557 | <p> |
| 558 | Like --allow-empty this command is primarily for use by foreign |
Junio C Hamano | 619596a | 2010-08-18 22:15:35 | [diff] [blame] | 559 | SCM interface scripts. It allows you to create a commit with an |
Junio C Hamano | cb39aea | 2010-05-09 07:24:48 | [diff] [blame] | 560 | empty commit message without using plumbing commands like |
| 561 | <a href="git-commit-tree.html">git-commit-tree(1)</a>. |
| 562 | </p> |
| 563 | </dd> |
| 564 | <dt> |
Junio C Hamano | 554da79 | 2007-12-27 03:29:58 | [diff] [blame] | 565 | --cleanup=<mode> |
| 566 | </dt> |
| 567 | <dd> |
| 568 | <p> |
| 569 | This option sets how the commit message is cleaned up. |
| 570 | The <em><mode></em> can be one of <em>verbatim</em>, <em>whitespace</em>, <em>strip</em>, |
| 571 | and <em>default</em>. The <em>default</em> mode will strip leading and |
| 572 | trailing empty lines and #commentary from the commit message |
| 573 | only if the message is to be edited. Otherwise only whitespace |
| 574 | removed. The <em>verbatim</em> mode does not change message at all, |
| 575 | <em>whitespace</em> removes just leading/trailing whitespace lines |
| 576 | and <em>strip</em> removes both whitespace and commentary. |
| 577 | </p> |
| 578 | </dd> |
| 579 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 580 | -e |
| 581 | </dt> |
| 582 | <dt> |
| 583 | --edit |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 584 | </dt> |
| 585 | <dd> |
| 586 | <p> |
| 587 | The message taken from file with <tt>-F</tt>, command line with |
| 588 | <tt>-m</tt>, and from file with <tt>-C</tt> are usually used as the |
| 589 | commit log message unmodified. This option lets you |
| 590 | further edit the message taken from these sources. |
| 591 | </p> |
| 592 | </dd> |
| 593 | <dt> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 594 | --amend |
| 595 | </dt> |
| 596 | <dd> |
| 597 | <p> |
| 598 | Used to amend the tip of the current branch. Prepare the tree |
| 599 | object you would want to replace the latest commit as usual |
| 600 | (this includes the usual -i/-o and explicit paths), and the |
| 601 | commit log editor is seeded with the commit message from the |
| 602 | tip of the current branch. The commit you create replaces the |
| 603 | current tip — if it was a merge, it will have the parents of |
| 604 | the current tip as parents — so the current top commit is |
| 605 | discarded. |
| 606 | </p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 607 | <div class="para"><p>It is a rough equivalent for:</p></div> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 608 | <div class="listingblock"> |
| 609 | <div class="content"> |
| 610 | <pre><tt> $ git reset --soft HEAD^ |
| 611 | $ ... do something else to come up with the right tree ... |
Junio C Hamano | 47ea30e | 2006-04-05 23:08:03 | [diff] [blame] | 612 | $ git commit -c ORIG_HEAD |
| 613 | </tt></pre> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 614 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 615 | <div class="para"><p>but can be used to amend a merge commit.</p></div> |
Junio C Hamano | 7d06a8a | 2008-10-20 05:42:33 | [diff] [blame] | 616 | <div class="para"><p>You should understand the implications of rewriting history if you |
| 617 | amend a commit that has already been published. (See the "RECOVERING |
| 618 | FROM UPSTREAM REBASE" section in <a href="git-rebase.html">git-rebase(1)</a>.)</p></div> |
Junio C Hamano | bfe9e75 | 2006-04-05 21:43:28 | [diff] [blame] | 619 | </dd> |
| 620 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 621 | -i |
| 622 | </dt> |
| 623 | <dt> |
| 624 | --include |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 625 | </dt> |
| 626 | <dd> |
| 627 | <p> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 628 | Before making a commit out of staged contents so far, |
| 629 | stage the contents of paths given on the command line |
| 630 | as well. This is usually not what you want unless you |
| 631 | are concluding a conflicted merge. |
Junio C Hamano | 6697ac5 | 2006-02-14 08:00:23 | [diff] [blame] | 632 | </p> |
| 633 | </dd> |
| 634 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 635 | -o |
| 636 | </dt> |
| 637 | <dt> |
| 638 | --only |
Junio C Hamano | e79159d | 2008-04-12 08:23:17 | [diff] [blame] | 639 | </dt> |
| 640 | <dd> |
| 641 | <p> |
| 642 | Make a commit only from the paths specified on the |
| 643 | command line, disregarding any contents that have been |
| 644 | staged so far. This is the default mode of operation of |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 645 | <em>git commit</em> if any paths are given on the command line, |
Junio C Hamano | e79159d | 2008-04-12 08:23:17 | [diff] [blame] | 646 | in which case this option can be omitted. |
| 647 | If this option is specified together with <em>--amend</em>, then |
Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 648 | no paths need to be specified, which can be used to amend |
Junio C Hamano | e79159d | 2008-04-12 08:23:17 | [diff] [blame] | 649 | the last commit without committing changes that have |
| 650 | already been staged. |
| 651 | </p> |
| 652 | </dd> |
| 653 | <dt> |
Junio C Hamano | 4224f99 | 2008-06-23 07:14:08 | [diff] [blame] | 654 | -u[<mode>] |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 655 | </dt> |
| 656 | <dt> |
Junio C Hamano | 4224f99 | 2008-06-23 07:14:08 | [diff] [blame] | 657 | --untracked-files[=<mode>] |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 658 | </dt> |
| 659 | <dd> |
| 660 | <p> |
Junio C Hamano | 4224f99 | 2008-06-23 07:14:08 | [diff] [blame] | 661 | Show untracked files (Default: <em>all</em>). |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 662 | </p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 663 | <div class="para"><p>The mode parameter is optional, and is used to specify |
Junio C Hamano | e1cca18 | 2010-02-20 20:01:23 | [diff] [blame] | 664 | the handling of untracked files.</p></div> |
| 665 | <div class="para"><p>The possible options are:</p></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 666 | <div class="ilist"><ul> |
Junio C Hamano | 4224f99 | 2008-06-23 07:14:08 | [diff] [blame] | 667 | <li> |
| 668 | <p> |
| 669 | <em>no</em> - Show no untracked files |
| 670 | </p> |
| 671 | </li> |
| 672 | <li> |
| 673 | <p> |
| 674 | <em>normal</em> - Shows untracked files and directories |
| 675 | </p> |
| 676 | </li> |
| 677 | <li> |
| 678 | <p> |
| 679 | <em>all</em> - Also shows individual files in untracked directories. |
| 680 | </p> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 681 | <div class="para"><p>See <a href="git-config.html">git-config(1)</a> for configuration variable |
Junio C Hamano | 4224f99 | 2008-06-23 07:14:08 | [diff] [blame] | 682 | used to change the default for when the option is not |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 683 | specified.</p></div> |
Junio C Hamano | e1cca18 | 2010-02-20 20:01:23 | [diff] [blame] | 684 | </li> |
| 685 | </ul></div> |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 686 | </dd> |
| 687 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 688 | -v |
| 689 | </dt> |
| 690 | <dt> |
| 691 | --verbose |
Junio C Hamano | 1e6e006 | 2007-07-13 05:33:25 | [diff] [blame] | 692 | </dt> |
| 693 | <dd> |
| 694 | <p> |
| 695 | Show unified diff between the HEAD commit and what |
| 696 | would be committed at the bottom of the commit message |
| 697 | template. Note that this diff output doesn't have its |
| 698 | lines prefixed with <em>#</em>. |
| 699 | </p> |
| 700 | </dd> |
| 701 | <dt> |
Junio C Hamano | eb41599 | 2008-06-08 22:49:47 | [diff] [blame] | 702 | -q |
| 703 | </dt> |
| 704 | <dt> |
| 705 | --quiet |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 706 | </dt> |
| 707 | <dd> |
| 708 | <p> |
Junio C Hamano | f9771f6 | 2007-01-17 17:42:30 | [diff] [blame] | 709 | Suppress commit summary message. |
Junio C Hamano | 7d23f5e | 2006-12-16 07:44:04 | [diff] [blame] | 710 | </p> |
| 711 | </dd> |
| 712 | <dt> |
Junio C Hamano | 1bb3199 | 2009-08-29 04:24:08 | [diff] [blame] | 713 | --dry-run |
| 714 | </dt> |
| 715 | <dd> |
| 716 | <p> |
| 717 | Do not create a commit, but show a list of paths that are |
| 718 | to be committed, paths with local changes that will be left |
| 719 | uncommitted and paths that are untracked. |
| 720 | </p> |
| 721 | </dd> |
| 722 | <dt> |
Junio C Hamano | 6ce6b6c | 2010-01-18 01:25:50 | [diff] [blame] | 723 | --status |
| 724 | </dt> |
| 725 | <dd> |
| 726 | <p> |
| 727 | Include the output of <a href="git-status.html">git-status(1)</a> in the commit |
| 728 | message template when using an editor to prepare the commit |
| 729 | message. Defaults to on, but can be used to override |
| 730 | configuration variable commit.status. |
| 731 | </p> |
| 732 | </dd> |
| 733 | <dt> |
| 734 | --no-status |
| 735 | </dt> |
| 736 | <dd> |
| 737 | <p> |
| 738 | Do not include the output of <a href="git-status.html">git-status(1)</a> in the |
| 739 | commit message template when using an editor to prepare the |
| 740 | default commit message. |
| 741 | </p> |
| 742 | </dd> |
| 743 | <dt> |
Junio C Hamano | 1bb569e | 2006-05-05 23:14:25 | [diff] [blame] | 744 | -- |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 745 | </dt> |
| 746 | <dd> |
| 747 | <p> |
| 748 | Do not interpret any more arguments as options. |
| 749 | </p> |
| 750 | </dd> |
| 751 | <dt> |
| 752 | <file>… |
| 753 | </dt> |
| 754 | <dd> |
| 755 | <p> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 756 | When files are given on the command line, the command |
| 757 | commits the contents of the named files, without |
| 758 | recording the changes already staged. The contents of |
| 759 | these files are also staged for the next commit on top |
| 760 | of what have been staged before. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 761 | </p> |
| 762 | </dd> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 763 | </dl></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 764 | </div> |
Junio C Hamano | ae05fee | 2010-01-08 07:39:46 | [diff] [blame] | 765 | <h2 id="_date_formats">DATE FORMATS</h2> |
| 766 | <div class="sectionbody"> |
| 767 | <div class="para"><p>The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables |
| 768 | and the <tt>--date</tt> option |
| 769 | support the following date formats:</p></div> |
| 770 | <div class="vlist"><dl> |
| 771 | <dt> |
| 772 | Git internal format |
| 773 | </dt> |
| 774 | <dd> |
| 775 | <p> |
| 776 | It is <tt><unix timestamp> <timezone offset></tt>, where <tt><unix |
| 777 | timestamp></tt> is the number of seconds since the UNIX epoch. |
| 778 | <tt><timezone offset></tt> is a positive or negative offset from UTC. |
| 779 | For example CET (which is 2 hours ahead UTC) is <tt>+0200</tt>. |
| 780 | </p> |
| 781 | </dd> |
| 782 | <dt> |
| 783 | RFC 2822 |
| 784 | </dt> |
| 785 | <dd> |
| 786 | <p> |
| 787 | The standard email format as described by RFC 2822, for example |
| 788 | <tt>Thu, 07 Apr 2005 22:13:13 +0200</tt>. |
| 789 | </p> |
| 790 | </dd> |
| 791 | <dt> |
| 792 | ISO 8601 |
| 793 | </dt> |
| 794 | <dd> |
| 795 | <p> |
| 796 | Time and date specified by the ISO 8601 standard, for example |
| 797 | <tt>2005-04-07T22:13:13</tt>. The parser accepts a space instead of the |
| 798 | <tt>T</tt> character as well. |
| 799 | </p> |
| 800 | <div class="admonitionblock"> |
| 801 | <table><tr> |
| 802 | <td class="icon"> |
| 803 | <div class="title">Note</div> |
| 804 | </td> |
| 805 | <td class="content">In addition, the date part is accepted in the following formats: |
| 806 | <tt>YYYY.MM.DD</tt>, <tt>MM/DD/YYYY</tt> and <tt>DD.MM.YYYY</tt>.</td> |
| 807 | </tr></table> |
| 808 | </div> |
| 809 | </dd> |
| 810 | </dl></div> |
| 811 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 812 | <h2 id="_examples">EXAMPLES</h2> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 813 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 814 | <div class="para"><p>When recording your own work, the contents of modified files in |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 815 | your working tree are temporarily stored to a staging area |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 816 | called the "index" with <em>git add</em>. A file can be |
Junio C Hamano | 361c133 | 2007-11-14 12:17:22 | [diff] [blame] | 817 | reverted back, only in the index but not in the working tree, |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 818 | to that of the last commit with <tt>git reset HEAD — <file></tt>, |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 819 | which effectively reverts <em>git add</em> and prevents the changes to |
Junio C Hamano | 361c133 | 2007-11-14 12:17:22 | [diff] [blame] | 820 | this file from participating in the next commit. After building |
| 821 | the state to be committed incrementally with these commands, |
| 822 | <tt>git commit</tt> (without any pathname parameter) is used to record what |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 823 | has been staged so far. This is the most basic form of the |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 824 | command. An example:</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 825 | <div class="listingblock"> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 826 | <div class="content"> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 827 | <pre><tt>$ edit hello.c |
| 828 | $ git rm goodbye.c |
| 829 | $ git add hello.c |
| 830 | $ git commit</tt></pre> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 831 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 832 | <div class="para"><p>Instead of staging files after each individual change, you can |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 833 | tell <tt>git commit</tt> to notice the changes to the files whose |
| 834 | contents are tracked in |
| 835 | your working tree and do corresponding <tt>git add</tt> and <tt>git rm</tt> |
| 836 | for you. That is, this example does the same as the earlier |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 837 | example if there is no other change in your working tree:</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 838 | <div class="listingblock"> |
| 839 | <div class="content"> |
| 840 | <pre><tt>$ edit hello.c |
| 841 | $ rm goodbye.c |
| 842 | $ git commit -a</tt></pre> |
| 843 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 844 | <div class="para"><p>The command <tt>git commit -a</tt> first looks at your working tree, |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 845 | notices that you have modified hello.c and removed goodbye.c, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 846 | and performs necessary <tt>git add</tt> and <tt>git rm</tt> for you.</p></div> |
| 847 | <div class="para"><p>After staging changes to many files, you can alter the order the |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 848 | changes are recorded in, by giving pathnames to <tt>git commit</tt>. |
| 849 | When pathnames are given, the command makes a commit that |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 850 | only records the changes made to the named paths:</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 851 | <div class="listingblock"> |
| 852 | <div class="content"> |
| 853 | <pre><tt>$ edit hello.c hello.h |
| 854 | $ git add hello.c hello.h |
| 855 | $ edit Makefile |
| 856 | $ git commit Makefile</tt></pre> |
| 857 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 858 | <div class="para"><p>This makes a commit that records the modification to <tt>Makefile</tt>. |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 859 | The changes staged for <tt>hello.c</tt> and <tt>hello.h</tt> are not included |
| 860 | in the resulting commit. However, their changes are not lost — |
| 861 | they are still staged and merely held back. After the above |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 862 | sequence, if you do:</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 863 | <div class="listingblock"> |
| 864 | <div class="content"> |
| 865 | <pre><tt>$ git commit</tt></pre> |
| 866 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 867 | <div class="para"><p>this second commit would record the changes to <tt>hello.c</tt> and |
| 868 | <tt>hello.h</tt> as expected.</p></div> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 869 | <div class="para"><p>After a merge (initiated by <em>git merge</em> or <em>git pull</em>) stops |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 870 | because of conflicts, cleanly merged |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 871 | paths are already staged to be committed for you, and paths that |
| 872 | conflicted are left in unmerged state. You would have to first |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 873 | check which paths are conflicting with <em>git status</em> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 874 | and after fixing them manually in your working tree, you would |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 875 | stage the result as usual with <em>git add</em>:</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 876 | <div class="listingblock"> |
| 877 | <div class="content"> |
| 878 | <pre><tt>$ git status | grep unmerged |
| 879 | unmerged: hello.c |
| 880 | $ edit hello.c |
| 881 | $ git add hello.c</tt></pre> |
| 882 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 883 | <div class="para"><p>After resolving conflicts and staging the result, <tt>git ls-files -u</tt> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 884 | would stop mentioning the conflicted path. When you are done, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 885 | run <tt>git commit</tt> to finally record the merge:</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 886 | <div class="listingblock"> |
| 887 | <div class="content"> |
| 888 | <pre><tt>$ git commit</tt></pre> |
| 889 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 890 | <div class="para"><p>As with the case to record your own changes, you can use <tt>-a</tt> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 891 | option to save typing. One difference is that during a merge |
| 892 | resolution, you cannot use <tt>git commit</tt> with pathnames to |
| 893 | alter the order the changes are committed, because the merge |
| 894 | should be recorded as a single commit. In fact, the command |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 895 | refuses to run when given pathnames (but see <tt>-i</tt> option).</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 896 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 897 | <h2 id="_discussion">DISCUSSION</h2> |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 898 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 899 | <div class="para"><p>Though not required, it's a good idea to begin the commit message |
Junio C Hamano | 8f76dc6 | 2007-01-17 07:24:25 | [diff] [blame] | 900 | with a single short (less than 50 character) line summarizing the |
| 901 | change, followed by a blank line and then a more thorough description. |
| 902 | Tools that turn commits into email, for example, use the first line |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 903 | on the Subject: line and the rest of the commit in the body.</p></div> |
| 904 | <div class="para"><p>At the core level, git is character encoding agnostic.</p></div> |
| 905 | <div class="ilist"><ul> |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 906 | <li> |
| 907 | <p> |
| 908 | The pathnames recorded in the index and in the tree objects |
| 909 | are treated as uninterpreted sequences of non-NUL bytes. |
| 910 | What readdir(2) returns are what are recorded and compared |
| 911 | with the data git keeps track of, which in turn are expected |
| 912 | to be what lstat(2) and creat(2) accepts. There is no such |
| 913 | thing as pathname encoding translation. |
| 914 | </p> |
| 915 | </li> |
| 916 | <li> |
| 917 | <p> |
Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 918 | The contents of the blob objects are uninterpreted sequences |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 919 | of bytes. There is no encoding translation at the core |
| 920 | level. |
| 921 | </p> |
| 922 | </li> |
| 923 | <li> |
| 924 | <p> |
Junio C Hamano | 54bf1e2 | 2008-12-20 06:30:11 | [diff] [blame] | 925 | The commit log messages are uninterpreted sequences of non-NUL |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 926 | bytes. |
| 927 | </p> |
| 928 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 929 | </ul></div> |
| 930 | <div class="para"><p>Although we encourage that the commit log messages are encoded |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 931 | in UTF-8, both the core and git Porcelain are designed not to |
| 932 | force UTF-8 on projects. If all participants of a particular |
| 933 | project find it more convenient to use legacy encodings, git |
| 934 | does not forbid it. However, there are a few things to keep in |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 935 | mind.</p></div> |
| 936 | <div class="olist"><ol> |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 937 | <li> |
| 938 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 939 | <em>git commit</em> and <em>git commit-tree</em> issues |
Junio C Hamano | 14b7648 | 2008-01-05 10:32:26 | [diff] [blame] | 940 | a warning if the commit log message given to it does not look |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 941 | like a valid UTF-8 string, unless you explicitly say your |
| 942 | project uses a legacy encoding. The way to say this is to |
Junio C Hamano | 35bb3f6 | 2007-02-19 05:35:53 | [diff] [blame] | 943 | have i18n.commitencoding in <tt>.git/config</tt> file, like this: |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 944 | </p> |
| 945 | <div class="listingblock"> |
| 946 | <div class="content"> |
Junio C Hamano | 35bb3f6 | 2007-02-19 05:35:53 | [diff] [blame] | 947 | <pre><tt>[i18n] |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 948 | commitencoding = ISO-8859-1</tt></pre> |
| 949 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 950 | <div class="para"><p>Commit objects created with the above setting record the value |
Junio C Hamano | 35bb3f6 | 2007-02-19 05:35:53 | [diff] [blame] | 951 | of <tt>i18n.commitencoding</tt> in its <tt>encoding</tt> header. This is to |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 952 | help other people who look at them later. Lack of this header |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 953 | implies that the commit log message is encoded in UTF-8.</p></div> |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 954 | </li> |
| 955 | <li> |
| 956 | <p> |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 957 | <em>git log</em>, <em>git show</em>, <em>git blame</em> and friends look at the |
Junio C Hamano | aa17c7c | 2008-11-03 04:36:58 | [diff] [blame] | 958 | <tt>encoding</tt> header of a commit object, and try to re-code the |
| 959 | log message into UTF-8 unless otherwise specified. You can |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 960 | specify the desired output encoding with |
Junio C Hamano | 35bb3f6 | 2007-02-19 05:35:53 | [diff] [blame] | 961 | <tt>i18n.logoutputencoding</tt> in <tt>.git/config</tt> file, like this: |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 962 | </p> |
| 963 | <div class="listingblock"> |
| 964 | <div class="content"> |
Junio C Hamano | 35bb3f6 | 2007-02-19 05:35:53 | [diff] [blame] | 965 | <pre><tt>[i18n] |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 966 | logoutputencoding = ISO-8859-1</tt></pre> |
| 967 | </div></div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 968 | <div class="para"><p>If you do not have this configuration variable, the value of |
| 969 | <tt>i18n.commitencoding</tt> is used instead.</p></div> |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 970 | </li> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 971 | </ol></div> |
| 972 | <div class="para"><p>Note that we deliberately chose not to re-code the commit log |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 973 | message when a commit is made to force UTF-8 at the commit |
| 974 | object level, because re-coding to UTF-8 is not necessarily a |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 975 | reversible operation.</p></div> |
Junio C Hamano | 775a0f4 | 2006-12-31 01:19:14 | [diff] [blame] | 976 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 977 | <h2 id="_environment_and_configuration_variables">ENVIRONMENT AND CONFIGURATION VARIABLES</h2> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 978 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 979 | <div class="para"><p>The editor used to edit the commit log message will be chosen from the |
Junio C Hamano | f6002a9 | 2007-07-20 10:28:22 | [diff] [blame] | 980 | GIT_EDITOR environment variable, the core.editor configuration variable, the |
| 981 | VISUAL environment variable, or the EDITOR environment variable (in that |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 982 | order). See <a href="git-var.html">git-var(1)</a> for details.</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 983 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 984 | <h2 id="_hooks">HOOKS</h2> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 985 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 986 | <div class="para"><p>This command can run <tt>commit-msg</tt>, <tt>prepare-commit-msg</tt>, <tt>pre-commit</tt>, |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 987 | and <tt>post-commit</tt> hooks. See <a href="githooks.html">githooks(5)</a> for more |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 988 | information.</p></div> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 989 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 990 | <h2 id="_see_also">SEE ALSO</h2> |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 991 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 992 | <div class="para"><p><a href="git-add.html">git-add(1)</a>, |
Junio C Hamano | e7935c4 | 2006-12-13 21:32:17 | [diff] [blame] | 993 | <a href="git-rm.html">git-rm(1)</a>, |
| 994 | <a href="git-mv.html">git-mv(1)</a>, |
| 995 | <a href="git-merge.html">git-merge(1)</a>, |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 996 | <a href="git-commit-tree.html">git-commit-tree(1)</a></p></div> |
Junio C Hamano | 40f2f8d | 2006-02-07 08:04:39 | [diff] [blame] | 997 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 998 | <h2 id="_author">Author</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 999 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1000 | <div class="para"><p>Written by Linus Torvalds <torvalds@osdl.org> and |
Junio C Hamano | 0868a30 | 2008-07-22 09:20:44 | [diff] [blame] | 1001 | Junio C Hamano <gitster@pobox.com></p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1002 | </div> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1003 | <h2 id="_git">GIT</h2> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1004 | <div class="sectionbody"> |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 1005 | <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1006 | </div> |
| 1007 | <div id="footer"> |
| 1008 | <div id="footer-text"> |
Junio C Hamano | ac752fa | 2010-09-19 00:01:00 | [diff] [blame] | 1009 | Last updated 2010-09-18 23:56:37 UTC |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1010 | </div> |
| 1011 | </div> |
| 1012 | </body> |
| 1013 | </html> |